<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
  
  <head>
    <title>批号添加</title>
    <jsp:include page="header.jsp"></jsp:include>
    <link rel="stylesheet" href="${pageContext.request.contextPath }/lib/kindeditor/themes/default/default.css" />
    <script charset="utf-8" src="${pageContext.request.contextPath }/lib/kindeditor/kindeditor-all.js"></script>
	<script charset="utf-8" src="${pageContext.request.contextPath }/lib/kindeditor/lang/zh-CN.js"></script>
    
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <style>
  	.my-upload {
  		display: block;
  		width: 100px;
  		height: 32px;
  		text-align: center;
  		margin-top: 10px;
  		background-color: red;
  		color:#ffffff;
  		line-height:32px;
  		font-size: 16px;
  	}
  </style>
  <body>
    <div class="x-body">
        <form class="layui-form" id="myForm" action="/admin/pihaoAdd" method="post">
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>药品批号
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="piName" name="piName" required="" lay-verify="required"
                  autocomplete="off" class="layui-input" value="${p.piName}">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>检验报告
              </label>
              <div class="layui-input-inline">
              		<a class="my-upload" href="javascript:;" id="image3">上传图片</a>
                  <input type="hidden" id="piReport" name="piReport" autocomplete="off" class="layui-input" value="${p.piReport}">
              </div>
          </div>
         <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  	药品名称:
              </label>
              <div class="layui-input-inline">
                 <select name="goodsId" class="input w50" id="orderBy">
	              <option value="">请选药品名称</option>
	              <c:if test="${not empty list}">
      				<c:forEach var="app" items="${list}" varStatus="st">
      			 	<option value="${app.id}">${app.goodsName}</option>
	              </c:forEach>
	              </c:if>
            </select>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <input type="hidden" name="id" value="${p.id}">
             <button  class="layui-btn" lay-filter="add" id="my_add">
                  增加
              </button>
             
          </div>
      </form>
    </div>
    <script type="text/javascript">
    KindEditor.ready(function(K) {
		var editor = K.editor({
			uploadJson : '${pageContext.request.contextPath }/admin/kindUpload',//标识处理图片的文件
			fileManagerJson :'${pageContext.request.contextPath }/admin/kindUpload',
			allowFileManager : true//允许上传文件和图片
		});
		K('#image3').click(function() {
			editor.loadPlugin('image', function() {
				editor.plugin.imageDialog({
					showRemote : false,
					clickFn : function(data) {
						K('#piReport').val(data);
						editor.hideDialog();
					}
				});
			});
		});
    })
    $('#my_add').click(function(){
    	 var form =$('#myForm');
    	 var remark =$('#piReport').val();
         if(remark==''){
         	layer.alert('请上传图片!');
         }
         var index = parent.layer.getFrameIndex(window.name);
         //关闭当前frame
         parent.layer.close(index);
         parent.location.reload();
         form.submit();
    })
	</script>
  </body>
</html>